<!DOCTYPE html>
<html>
<#include "../../common/header.ftl">
<script src="${basePath}/js/refund/list.js?v=201711021700"></script>

<head>
<meta charset="UTF-8">
<title>售后单管理</title>
<style>
	.left{
		float:left;
		min-width:100px;
		margin-left: 10px;
	}
	.table-margin{
		margin:5px 3%;
		width:92%;
	}
</style>

</head>
<body>
   
<div class="container" style="margin-left:5%;width:90%">
	<form class="layui-form left" action="#" >
		<div class="layui-form-item ">
			<label class="layui-form-label left">售后状态</label>
		    <div class="layui-input-block left">
		      <select name="status" >
		        <option value="">所有</option>
		        <option value="">所有</option>
		        <option value="00" <#if param.status?? && param.status=='00'>selected </#if>>待审核</option>
		        <option value="10" <#if param.status?? && param.status=='10'>selected </#if>>待退货</option>
		        <option value="20" <#if param.status?? && param.status=='20'>selected </#if>>待收货</option>
		        <option value="30" <#if param.status?? && param.status=='30'>selected </#if>>待退款</option>
		        <option value="40" <#if param.status?? && param.status=='40'>selected </#if>>已完成</option>
		        <option value="50" <#if param.status?? && param.status=='50'>selected </#if>>已取消</option>
		      </select>
		    </div>
		    <label class="layui-form-label left">创建时间</label>
		    <div class="layui-input-inline left">
		      <input class="layui-input" placeholder="开始" id="createTimeStart" readonly  value="${param.createTimeStart!}">
		    </div>
		    <div class="layui-form-mid">-</div>
		    <div class="layui-input-inline left">
		      <input class="layui-input " placeholder="截止" id="createTimeEnd" readonly  value="${param.createTimeEnd!}">
		    </div>
		</div>
		<div class="layui-form-item ">
		 	<label class="layui-form-label left">退款时间</label>
		    <div class="layui-input-inline left">
		      <input class="layui-input" placeholder="开始" id="refundTimeStart" readonly value="${param.refundTimeStart!}">
		    </div>
		    <div class="layui-form-mid">-</div>
		    <div class="layui-input-inline left">
		      <input class="layui-input " placeholder="截止" id="refundTimeEnd" readonly  value="${param.refundTimeEnd!}">
		    </div>
			<label class="layui-form-label left">退款金额</label>
		    <div class="layui-input-inline left">
		      <input class="layui-input" placeholder="最小值"   name="refundJeMin" value="${param.refundJeMin!}">
		    </div>
		    <div class="layui-form-mid">-</div>
		    <div class="layui-input-inline left">
		      <input class="layui-input " placeholder="最大值"  name="refundJeMax" value="${param.refundJeMax!}">
		    </div>
		</div>
		<div class="layui-form-item ">
		    <div class="layui-input-block left">
		      <input type="text" name="keyword" value="${param.keyword!}"   placeholder="昵称/手机号/订单编号/退货单编号"  
		      class="layui-input" style="width:400px;margin-right:200px;margin-left:30px">
		    </div>
		     <div class="layui-input-block left">
		      <button type="button" class="layui-btn"  id="search-button">搜索</button>
		    </div>
		</div>
	</form>
</div>
<table class="table table-margin">
  <thead>
      <tr>
         <th>售后单编号</th>
         <th>订单编号</th>
         <th>用户账号</th>
         <th>用户昵称</th>
         <th>订单状态</th>
         <th>申请退款金额</th>
         <th>申请时间</th>
         <th>退款金额</th>
         <th>退款时间</th>
         <th>操作</th>
      </tr>
  </thead>
  <tbody>
	<#list page.itemList! as refund>
		<tr>
			<td><a href="javascript:void(0);" onclick="showDetail('${refund.id!}')">${refund.refundNo!}</a></td>
			<td><a href="javascript:void(0);" onclick="showOrderDetail('${refund.orderId!}')">${refund.orderNo!}</a></td>
			<td>${refund.mobileNo!}</td>
			<td>${refund.nickname!}</td>
			<td>${refund.statusName!}</td>
			<td>${refund.applyJe?string('#0.00')}</td>
			<td>${refund.createTime!}</td>
			<td>${refund.refundJe?string('#0.00')}</td>
			<td>${refund.refundTime!}</td>
			<td>
				<div class="btn-group">
				  <button type="button" class="btn btn-primary dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				    	操作<span class="caret"></span>
				  </button>
				  <ul class="dropdown-menu">
				  <#if refund.status == '00'>
				  <#if permission?? && (permission.P905??)>
				  	<li><a href="javascript:void(0);" onclick="checkRefundFun('${refund.id}','1')">审核订单</a></li>
				  	<li><a href="javascript:void(0);" onclick="checkRefundFun('${refund.id}','-1')">取消订单</a></li>
				  </#if>
				  <#elseif refund.status == '10'>
				  <#if permission?? && (permission.P908??)>
				    <li><a href="javascript:void(0);" onclick="sendGoodsFun('${refund.id}')">发货</a></li>
				  </#if>
				  <#elseif refund.status == '20'>
				  <#if permission?? && (permission.P909??)>
				    <li><a href="javascript:void(0);" onclick="takeGoodsFun('${refund.id}')">收货</a></li>
				  </#if>
				  <#elseif refund.status == '30'>
				  <#if permission?? && (permission.P910??)>
				    <li><a href="javascript:void(0);" onclick="refundMoneyFun('${refund.id}')">退款</a></li>
				  </#if>
				  </#if>
				  <#if refund.status == '00' || refund.status == '10' || refund.status == '20' >
				  	<#if permission?? && (permission.P904??)>
				  	<li><a href="javascript:void(0);" onclick="editRefundFun('${refund.id}')">修改售后单</a></li>
				  	</#if>
				  </#if>
				  </ul>
				</div>
			</td>
		</tr>
	</#list>
  </tbody>
</table>
	<#-- 翻页模块代码 -->
	<ul class="pager">
		<li><a href="javascript:void(0);" onclick="fanye('1')">首页</a></li>
		<#if (page.pageNo>1) > 
		<li><a	href="javascript:void(0);" onclick="fanye('${page.prevPage}')">上一页</a></li>
		<#else>
		<li><a href="javascript:void(0);">上一页</a></li> 
		</#if>
		<li><a href="javascript:void(0);">第${page.pageNo}页/共${page.totalPage}页</a></li>
		<#if (page.nextPage>page.pageNo) >
		<li><a href="javascript:void(0);" onclick="fanye('${page.nextPage}')">下一页</a></li>
		<#else>
		<li><a href="javascript:void(0);">下一页</a></li>
		</#if>
		<li><a href="javascript:void(0);" onclick="fanye('${page.totalPage}')">尾页</a></li>
	</ul>
  
</body>
<script type="text/javascript">
	var basePath="${basePath}";
	var init={
	    status:"${param.status!}",
		keyword:"${param.keyword!}",
		createTimeStart:"${param.createTimeStart!}",
		createTimeEnd:"${param.createTimeEnd!}",
		refundTimeStart:"${param.refundTimeStart!}",
		refundTimeEnd:"${param.refundTimeEnd!}",
		refundJeMin:"${param.refundJeMin!}",
		refundJeMax:"${param.refundJeMax!}"
	}
	$(function(){
		layui.use(['form', 'layer','laydate'] , function(){
		  var layer = layui.layer;
		  var form = layui.form(); 
		  
		  var laydate = layui.laydate;
		  var c_min;
		  if(init.createTimeStart){
		  	c_min=init.createTimeStart;
		  }else{
		  	c_min=laydate.now();
		  }
		  var c_max;
		  if(init.createTimeEnd){
		  	c_max=init.createTimeEnd;
		  }else{
		  	c_max='2099-12-29';
		  }
		  var c_start = {
		    min: '2017-01-01' 
		    ,max: c_max
		    ,istoday: false
		    ,choose: function(datas){
		      c_end.min = datas; //开始日选好后，重置结束日的最小日期
		      c_end.start = datas //将结束日的初始值设定为开始日
		    }
		  };
		  var c_end = {
		    min: c_min
		    ,max: '2099-12-29'
		    ,istoday: false
		    ,choose: function(datas){
		      c_start.max = datas; //结束日选好后，重置开始日的最大日期
		    }
		  };
		  var r_min;
		  if(init.refundTimeStart){
		  	r_min=init.refundTimeStart;
		  }else{
		  	r_min=laydate.now();
		  }
		  var r_max;
		  if(init.refundTimeEnd){
		  	r_max=init.refundTimeEnd;
		  }else{
		  	r_max='2099-12-29';
		  }
		  var r_start = {
		    min: '2017-01-01' 
		    ,max: r_max
		    ,istoday: false
		    ,choose: function(datas){
		      r_end.min = datas; //开始日选好后，重置结束日的最小日期
		      r_end.start = datas //将结束日的初始值设定为开始日
		    }
		  };
		 
		  var r_end = {
		    min: r_min
		    ,max: '2099-12-29'
		    ,istoday: false
		    ,choose: function(datas){
		      r_start.max = datas; //结束日选好后，重置开始日的最大日期
		    }
		  };
		  document.getElementById('createTimeStart').onclick = function(){
		    c_start.elem = this;
		    laydate(c_start);
		  }
		  document.getElementById('createTimeEnd').onclick = function(){
		    c_end.elem = this
		    laydate(c_end);
		  }
		  document.getElementById('refundTimeStart').onclick = function(){
		    r_start.elem = this;
		    laydate(r_start);
		  }
		  document.getElementById('refundTimeEnd').onclick = function(){
		    r_end.elem = this
		    laydate(r_end);
		  }
	});
});
</script>
</html>